#pragma once

#include <QString>
#include <QDateTime>
#include <QJsonObject>

namespace qtc_alarm_core {

struct AlarmEvent {
  QString type;        // "state" | "cmd" | "config"
  QString config;      // configuration name, e.g., "Accelerator"
  QString pv;          // process variable name
  QString root;        // root filter key
  QString severity;    // e.g. MINOR, MAJOR, OK
  QString message;     // message text
  QString state;       // textual state (active, acknowledged, ...)
  qint64  time_epoch_ms {0};
  QString user;        // user performing command
  QString host;        // host
  QString command;     // command name for cmd events
  QStringList tags;    // optional tags

  QJsonObject toJson() const;
  static AlarmEvent fromJson(const QJsonObject& obj);
};

} // namespace qtc_alarm_core